package vip.ola.core.service.code;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import vip.ola.core.entity.code.CodeUser;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;


/**
 * <p>
 * 码商用户表 服务类
 * </p>
 *
 * @author faker
 * @since 2020-03-25
 */
public interface CodeUserService extends IService<CodeUser> {

    boolean add(CodeUser codeUser);

    Map count(int currentPage, int pageSize, CodeUser codeUser);

    IPage<CodeUser> list(int currentPage, int pageSize, CodeUser codeUser);

    CodeUser getByCodeUser(CodeUser codeUser);

    CodeUser getByName(String username);

    CodeUser getCacheById(long id);

    void addCollAmount(long userId, BigDecimal amount, BigDecimal profit);

    List<Map> getByUserType(int type, Long codeBusId);

    boolean update(CodeUser codeUser);

    boolean cleanAmount(long userId);

    int updateUserAgentRate(long agentId, BigDecimal rate);

    int updateUserBusRate(long codeBusId, BigDecimal rate);

    /**
     * 冻结用户金额
     * @param userId
     * @param amount
     * @return
     */
    int frozenAmount(long userId, BigDecimal amount);

    /**
     * 修改结算金额
     * @param userId
     * @param amount
     * @return
     */
    int updateSettAmount(long userId, int settStatus, BigDecimal amount);

    boolean updateAmountById(long id, BigDecimal changeAmount, String bizItem, int fundDirection, String orderNo, String remark);
}
